package de.wiroo.setup.domain;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderColumn;

import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Whole {

	private String name;

	private Integer number;

	private double someDouble;

	private int someInt;

	private Date someDate;

	private Calendar someCalendar;

	private boolean someBoolean;

	private Boolean someBooleanObject;

	@OneToMany(cascade = CascadeType.ALL)
	private List<Part> manyParts = new ArrayList<Part>();

	@OneToMany
	@OrderColumn
	private List<Part> manyPartsSelect = new ArrayList<Part>();

	@OneToOne(cascade = CascadeType.ALL)
	private Part onePart;

	@ElementCollection
	private List<String> tags;

	@ElementCollection
	private List<Integer> numbers;

	@ElementCollection
	private List<EmbeddedPart> embeddedPart = new ArrayList<EmbeddedPart>();

	private Vote vote;

	@ElementCollection
	private List<Vote> manyVotes = new ArrayList<Vote>();

	@OneToOne(cascade = CascadeType.ALL)
	private SelfRef demo;

	public void refresh() {
		entityManager().refresh(this);

	}
}
